package com.example.demo.service.impl;


import java.util.List;

import javax.annotation.Resource;


import org.springframework.stereotype.Service;

import com.example.demo.bean.Category;
import com.example.demo.dao.CategoryDao;
import com.example.demo.service.ICategoryService;

//交给  ioc控制
@Service
public class ICategoryServiceImpl implements   ICategoryService {
	
	//使用注解引入对象
	@Resource
	private CategoryDao catedao;
	
	
	//实现接口的方法
	public void save(Category cg) {
		
		catedao.save(cg);
	}


	@Override
	public List<Category> findAll() {
		// TODO Auto-generated method stub
		return catedao.selectAll();
	}


	@Override
	public Category findById(Long id) {
		// TODO Auto-generated method stub
		return catedao.selectById(id);
	}
	
	
	
	@Override
	public void delteCategory(String name) {
		
		catedao.deleteByName(name);
	}
	
	

	@Override
	public void changeCategory(String name, Long id) {
		// TODO Auto-generated method stub
		
		catedao.updateCategory(name, id);
	}
	
	

	

}
